package com.yunxi.module.system.service.logger.impl;

import com.yunxi.framework.common.util.object.BeanUtils;
import com.yunxi.module.system.dto.logger.LoginLogCreateReqDTO;
import com.yunxi.module.system.model.logger.LoginLogDO;
import com.yunxi.module.system.mapper.logger.LoginLogMapper;
import com.yunxi.module.system.service.logger.LoginLogService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * <p>
 * 登录日志 Service 接口实现类
 * </p>
 *
 * @author lidy
 * @since 2024-05-08
 */
@Service
@Validated
public class LoginLogServiceImpl implements LoginLogService {

    @Resource
    private LoginLogMapper loginLogMapper;

    /**
     * 创建登录日志
     *
     * @param reqDTO 日志信息
     */
    @Override
    public void createLoginLog(LoginLogCreateReqDTO reqDTO) {
        LoginLogDO loginLogDO = BeanUtils.toBean(reqDTO, LoginLogDO.class);
        loginLogMapper.insert(loginLogDO);
    }
}
